﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using App.Interface;
using Newtonsoft.Json;

namespace App.Realization
{
    public class ZhiWu : IZhiWu
    {
        public void DelZhiWu(int zwid)
        {
            var result = HttpClientHelper.GetResponse(System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/DelZhiWu?zwid=" + zwid);
            //return result;
        }

        public string GetZhiWuList()
        {
            var reslut = HttpClientHelper.PostResponse(System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/GetZhiWus", "");
            return reslut;
        }

        public void SaveZhiWu(Model.ZhiWu zhiwu)
        {
            dynamic a = new { pid = zhiwu.PZhiWei.zwid, zwmc = zhiwu.zwmc };
            var postData = JsonConvert.SerializeObject(a);
            var result = HttpClientHelper.PostResponse(System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/SaveZhiWu", postData);
        }

        public void UpdateZhiWu(Model.ZhiWu zhiwu)
        {
            dynamic a = new {zwid=zhiwu.zwid, pid = zhiwu.PZhiWei.zwid, zwmc = zhiwu.zwmc };
            var postData = JsonConvert.SerializeObject(a);
            var result = HttpClientHelper.PostResponse(System.Web.Configuration.WebConfigurationManager.AppSettings["schoolapi"] + "/api/KeShi/UpdateZhiWu", postData);
        }
    }
}
